<template>
	<!-- 项目 -->
	<view class="upload">
		<uniTabs :tabs="tabs" :activeTab="activeTab" lineHeight="false" @change="change" activeColor="#DD524D"
			class="tabs"></uniTabs>
		<view v-if="activeTab==0">
			<view v-for="(item,index) in touBiaoData" class="zhao-biao">
				<p class="item-title">{{item.bidding_name}}</p>
				<view class="item-content">
					<p class="tab-first">{{item.bidding_type}}</p>
					<p class="tab-second">{{item.bidding_state}}</p>
				</view>
				<view class="item-name">
					<p class="tab-first">{{item.company_id_name}}</p>
					<p class="tab-second">{{item.project_begin_date}}</p>
				</view>
			</view>
			<image v-if="touBiaoData.length<1"
				style="position: absolute;top:0;left: 0;bottom: 0;right: 0;margin: auto;width: 600rpx;"
				src="../../../static/image/no-data.png" mode=""></image>
		</view>
		<view v-if="activeTab==1">
			<view v-for="(item,index) in zhongBiaoData" class="zhao-biao">
				<p class="item-title">{{item.bidding_name}}</p>
				<view class="item-content">
					<p class="tab-first">{{item.bidding_type}}</p>
					<p class="tab-second-over">{{item.bidding_state}}</p>
				</view>
				<view class="item-name">
					<p class="tab-first">{{item.company_id_name}}</p>
					<p class="tab-second">{{item.project_begin_date}}</p>
				</view>
			</view>
			<image v-if="zhongBiaoData.length<1"
				style="position: absolute;top:0;left: 0;bottom: 0;right: 0;margin: auto;width: 600rpx;"
				src="../../../static/image/no-data.png" mode=""></image>
		</view>

	</view>
</template>

<script>
	import uniTabs from '@/components/v-tabs/v-tabs.vue'
	import api from '@/static/js/api.js'
	export default {
		components: {
			uniTabs
		},

		data() {
			return {
				tabs: [
					'已投标',
					'已中标',
				],
				activeTab: 0,
				touBiaoData: '',
				userinfo: '',
				zhongBiaoData: ''
			}
		},
		onShow() {
			this.userinfo = JSON.parse(uni.getStorageSync('userInfo'));
			this.tenderList()
		},
		methods: {
			change(index) {
				this.activeTab = index
				if (this.activeTab == 0) {
					api.classTender('jhj.bidding.unusual', '_api_page', this.userinfo.access_token, this.userinfo.uid,
						this
						.userinfo.partner_id, this.userinfo.uid, 1000, 1).then(res => {
						this.touBiaoData = res.data
					}).catch(e => {
						uni.showToast({
							icon: 'none',
							title: e.message
						})
					})
				} else {
					let domain = "[('bidding_state', '=', '确认中标')]"
					api.classWining('jhj.bidding.unusual', '_api_page', this.userinfo.access_token, this.userinfo.uid,
						this
						.userinfo.partner_id, domain, this.userinfo.uid, 1000, 1).then(res => {
						this.zhongBiaoData = res.data
					}).catch(e => {
						uni.showToast({
							icon: 'none',
							title: e.message
						})
					})

				}
			},
			tenderList() {
				api.classToubiao('jhj.bidding.unusual', '_api_page', this.userinfo.access_token, this.userinfo.uid, this
					.userinfo.partner_id, this.userinfo.uid, 1000, 1).then(res => {
					this.touBiaoData = res.data
				}).catch(e => {
					uni.showToast({
						icon: 'none',
						title: e.message
					})
				})
			}
		}

	}
</script>

<style lang="less" scoped>
	.upload {
		width: 100%;
		height: 100vh;
		background-color: #EBEEF5;
	}

	.tabs {
		position: relative;
	}

	/deep/ .v-tabs {
		width: 100%;
		height: 100rpx;
		background-color: #FFFFFF;
		line-height: 100rpx;
	}

	/deep/ .v-tabs__container-item {
		width: 50%;
		justify-content: center;
	}

	.zhao-biao {
		border-bottom: 1px solid #F5F5F5;
		background-color: #FFFFFF;
		// height: 200rpx;
		width: 100%;
		margin-top: 10rpx;
		padding-top: 20rpx;

		.item-title {
			width: 94%;
			margin: 0 auto;

		}

		.item-content {
			width: 94%;
			margin: 0 auto;
			display: flex;

			.tab-first,
			.tab-second {
				background-color: #1E90FF;
				color: #FFFFFF;
				padding: 4rpx 4rpx;
				border-radius: 10rpx;
				font-size: 26rpx;
				border: 1px solid #1E90FF;
				margin: 12rpx 0;
			}

			.tab-second {
				margin-left: 10rpx;

			}

			.tab-second-over {
				background-color: #DCDCDC;
				color: #FFFFFF;
				padding: 4rpx 4rpx;
				border-radius: 10rpx;
				font-size: 26rpx;
				border: 1px solid #DCDCDC;
				margin: 12rpx 0;
				margin-left: 10rpx;
			}
		}

		.item-name {
			width: 94%;
			margin: 0 auto;
			display: flex;
			justify-content: space-between;

			.tab-first,
			.tab-second {
				color: #D3D3DC;
				font-size: 24rpx;
				margin: 12rpx 0;
			}

			.tab-second-over {
				background-color: #DCDCDC;
				color: #FFFFFF;
				padding: 4rpx 4rpx;
				border-radius: 10rpx;
				font-size: 26rpx;
				border: 1px solid #DCDCDC;
				margin: 12rpx 0;
				margin-left: 10rpx;
			}
		}
	}
</style>
